/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 根元素样式 */
:root {
    /* 色彩系统 */
    --color-primary-light: rgba(59, 130, 246, 0.15);
    --color-primary-mid: rgba(59, 130, 246, 0.4);
    --color-primary-main: rgba(59, 130, 246, 0.92);
    --color-primary-dark: rgba(37, 99, 235, 0.96);
    --color-primary-border: rgba(59, 130, 246, 0.4);
    --color-primary-hover: rgba(59, 130, 246, 0.2);
    --color-text-primary: #334155;
    --color-text-secondary: #64748b;
    --color-bg-light: rgba(248, 250, 252, 0.9);
    --color-bg-card: rgba(255, 255, 255, 0.9);
    --color-success: rgba(16, 185, 129, 0.92);
    --color-warning: rgba(234, 179, 8, 0.98);
    --color-error: rgba(239, 68, 68, 0.92);
    
    /* 间距规范 */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* 圆角规范 */
    --radius-small: 8px;
    --radius-card: 12px;
    
    /* 阴影规范 */
    --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.02);
    --shadow-card-hover: 0 6px 16px rgba(0, 0, 0, 0.04);
    
    /* 动画时长 */
    --transition-fast: 0.2s;
    --transition-normal: 0.25s;
    --transition-slow: 0.3s;
}

/* 正文样式 */
body {
    font-family: Inter, system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--color-text-primary);
    background-color: var(--color-bg-light);
}

/* 排版规范 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: 0.5px;
    line-height: 1.3;
}

h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
}

h2 {
    font-size: 1.25rem;
}

h3 {
    font-size: 0.875rem;
}

p {
    line-height: 1.6;
}

/* 卡片样式 */
.card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-primary-border);
    border-radius: var(--radius-card);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-card);
    transition: all var(--transition-normal) ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}

/* 输入框样式 */
input[type="text"],
input[type="number"],
select,
textarea {
    transition: all var(--transition-slow) ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary-main);
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* 按钮样式增强 */
button {
    cursor: pointer;
    transition: all var(--transition-slow) ease;
    font-family: inherit;
    border: none;
    outline: none;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 表单组样式 */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
}

/* 规则项样式 */
.rule-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    background-color: var(--color-bg-light);
    border: 1px solid var(--color-primary-border);
    border-radius: var(--radius-small);
    transition: all 0.2s ease;
}

.rule-item:hover {
    background-color: rgba(248, 250, 252, 1);
    border-color: var(--color-primary-main);
    transform: translateX(4px);
}

.rule-info {
    flex: 1;
}

.rule-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* 动画定义 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 动画类 */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.fade-out {
    animation: fadeOut 0.3s ease-in;
}

.slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

.bounce {
    animation: bounce 0.6s ease;
}

.pulse {
    animation: pulse 2s infinite;
}

.float {
    animation: float 3s ease-in-out infinite;
}

.loading-spin {
    animation: spin 1s linear infinite;
}

/* 过渡效果类 */
.transition-all-200 {
    transition: all 0.2s ease;
}

.transition-all-300 {
    transition: all 0.3s ease;
}

.transition-colors-300 {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.transition-transform-300 {
    transition: transform 0.3s ease;
}

/* 交互增强类 */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.02);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* 玻璃态效果 */
.glass-effect {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* 激活指示器 */
.active-indicator::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--color-primary-main);
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-small);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 4px 8px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    max-width: 400px;
    min-width: 320px;
    transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-align: center;
    animation: pulse 2s infinite alternate;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2), 0 6px 12px rgba(0, 0, 0, 0.15);
}

.notification::before {
    content: '';
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'FontAwesome';
    font-size: 14px;
}

.notification.success {
    background-color: var(--color-success);
    color: white;
}

.notification.success::before {
    content: '✓';
    background-color: rgba(255, 255, 255, 0.2);
}

.notification.warning {
    background-color: var(--color-warning);
    color: white;
}

.notification.warning::before {
    content: '!';
    background-color: rgba(255, 255, 255, 0.3);
}

.notification.error {
    background-color: var(--color-error);
    color: white;
}

.notification.error::before {
    content: '✗';
    background-color: rgba(255, 255, 255, 0.2);
}

.notification.info {
    background-color: var(--color-info);
    color: white;
}

.notification.info::before {
    content: 'ℹ';
    background-color: rgba(255, 255, 255, 0.2);
}

/* 淡入淡出动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-100%);
    }

.fade-in {
    animation: fadeIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.fade-out {
    animation: fadeOut 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* 脉冲动画增强可见性 */
@keyframes pulse {
    from {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 4px 8px rgba(0, 0, 0, 0.12);
    }
    to {
        box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2), 0 8px 16px rgba(0, 0, 0, 0.15);
    }
}

/* 响应式通知 */
@media (max-width: 768px) {
    .notification {
        left: 1rem;
        right: 1rem;
        min-width: auto;
        max-width: none;
        width: calc(100% - 2rem);
        left: 1rem;
        max-width: none;
        min-width: 0;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.15);
}

/* 响应式设计增强 */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .button-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .button-group button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .form-group label,
    .form-group input,
    .form-group select {
        font-size: 0.875rem;
    }
}